package com.zzq.service.impl;

import com.zzq.annotation.EnableMyPage;
import com.zzq.domain.entity.SmilePhotographerDividendRule;
import com.zzq.domain.search.DividendRuleSearchParamet;
import com.zzq.result.SmileResult;
import com.zzq.service.DividendRuleService;
import com.zzq.service.SmilePhotographerDividendRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class DividendRuleServiceImpl implements DividendRuleService {

    @Autowired
    SmilePhotographerDividendRuleService dividendRuleService;
    @Override
    @EnableMyPage
    public SmileResult list(DividendRuleSearchParamet searchParamet) {
        List<SmilePhotographerDividendRule> list = dividendRuleService.list();
        return SmileResult.sucess("规则获取成功",list);
    }

    @Override
    @Transactional
    public SmileResult del(Long dividendRuleId) {
        dividendRuleService.removeById(dividendRuleId);
        return SmileResult.sucess("删除成功");
    }

    @Override
    @Transactional
    public SmileResult upd(SmilePhotographerDividendRule dividendRule) {
        dividendRuleService.updateById(dividendRule);
        return SmileResult.sucess("更新成功");
    }

    @Override
    @Transactional
    public SmileResult add(SmilePhotographerDividendRule dividendRule) {
        dividendRuleService.save(dividendRule);
        return SmileResult.sucess("添加成功");
    }
}
